function handles = arrayCellParams(handles, dataArray)
% arrayCellParams
%
% Takes in a 2D data array (columns = traces, in sequence).
%
% Editing:
% gs april 2005 -- privatized for mapAnalysis2p0
% --------------------------------------------------------------------------------

[rows, numTraces] = size(dataArray); % must be 2D data array; col num = trace num

handles.data.map.mapActive.rseries = [];
handles.data.map.mapActive.rmembrane = [];
handles.data.map.mapActive.cmembrane = [];

for n = 1 : handles.data.analysis.RsSkipVal : numTraces
    try
        [Rs, Rm, Cm] = getRC(dataArray(:, n), handles.data.analysis.rstepOn, ...
            handles.data.analysis.rstepDur, handles.data.analysis.rstepAmp, ...
            handles.data.acq.sampleRate, handles.data.analysis.skipCm);
    catch
        Rs = NaN;
        Rm = NaN;
        Cm = NaN;
        disp(['Unable to calculate cell parameters for trace ' num2str(n)]);
    end

    handles.data.map.mapActive.rseries = [handles.data.map.mapActive.rseries Rs];
    handles.data.map.mapActive.rmembrane = [handles.data.map.mapActive.rmembrane Rm];
    handles.data.map.mapActive.cmembrane = [handles.data.map.mapActive.cmembrane Cm];

    disp(['Cell parameters for trace ' num2str(n) ' analyzed']);
end

Rs = handles.data.map.mapActive.rseries;
Rm = handles.data.map.mapActive.rmembrane;
Cm = handles.data.map.mapActive.cmembrane;

handles.data.map.mapAvg.rseries = [handles.data.map.mapAvg.rseries Rs];
handles.data.map.mapAvg.rmembrane = [handles.data.map.mapAvg.rmembrane Rm];
handles.data.map.mapAvg.cmembrane = [handles.data.map.mapAvg.cmembrane Cm];
